package function;

import model.Author;
import model.GetAuthors;

import java.util.Comparator;
import java.util.List;

public class Sorted {
    public static void main(String[] args) {
        List<Author> authors = GetAuthors.getAuthors();
//        Comparator
        authors.stream()
                .distinct()
                .sorted((o1, o2) ->o2.getAge()-o1.getAge() )
                .forEach((author -> {
                    System.out.println(author.getName()+" "+author.getAge());
                }));
    }
}
